package loaderlib.LocalCache
{
	import mx.utils.Base64Decoder;
	import mx.utils.Base64Encoder;
	
	/**
	 * Translate between name and url.
	 * 
	 * @author TangZhen
	 * 
	 */
	public final class CachedNameFilter
	{
		
		private static var urlEncode:Base64Encoder = new Base64Encoder()
		private static var urlDecode:Base64Decoder = new Base64Decoder()
		
		/**
		 * modify the spectial word (: ? @)  on url 
		 * 
		 * <span><p>
		 * this function use base64 to encode the url string.
		 * </p></span>
		 * 
		 * @param url
		 * @return 
		 * 
		 */
		public static function url2name(url:String):String
		{
			CachedNameFilter.urlEncode.encode(url)
			return urlEncode.toString();
		}
		
		public static function name2url(name:String):String
		{
			CachedNameFilter.urlDecode.decode(name)
			return urlDecode.toByteArray().toString();
		}
	}
}